package com.weiyun.shortlink.admin.remote;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.weiyun.shortlink.admin.common.convention.result.Result;
import com.weiyun.shortlink.admin.dto.resp.ShortLinkStatsRespDTO;
import com.weiyun.shortlink.admin.remote.dto.req.*;
import com.weiyun.shortlink.admin.remote.dto.resp.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/***
 *   @Author:weiyun
 *
 */
@FeignClient(value = "short-link-project", url = "${aggregation.remote-url:}")
public interface ShortLinkActualRemoteService {
    @PostMapping("/api/shortLink/v1/create")
    Result<ShortLinkCreateRespDto> createShortLink(@RequestBody ShortLinkCreateReqDto shortLinkCreateReqDto);

    @GetMapping("/api/shortLink/v1/page")
    Result<Page<ShortLinkPageRespDto>> pageShortLink(@RequestParam("gid") String gid, @RequestParam("orderTag") String orderTag, @RequestParam("current") Long current, @RequestParam("size") Long size);

    @GetMapping("/api/shortLink/v1/count")
    Result<List<ShortLinkQueryCountRespDto>> listShortLinkGroupCount(@RequestParam("requestParam") List<String> requestParam);

    @PostMapping("/api/shortLink/v1/update")
    void updateShortLink(@RequestBody ShortLinkUpdateReqDto shortLinkUpdateReqDto);

    @GetMapping("/api/shortLink/v1/title")
    Result<String> getTitleByUrl(@RequestParam("url") String url);

    @PostMapping("/api/shortLink/v1/recycle-bin/save")
    void save(RecycleBinSaveReqDto recycleBinSaveReqDto);

    @GetMapping("/api/shortLink/v1/recycle-bin/page")
    Result<Page<ShortLinkPageRespDto>> pageRecycleBin(@RequestParam("gid") List<String> gid,@RequestParam("current") Long current,@RequestParam("size") Long size);

    @PostMapping("/api/shortLink/v1/recycle-bin/recover")
    void recoverShortLink(@RequestBody RecycleBinRecoverReqDto requestParam);

    @PostMapping("/api/shortLink/v1/recycle-bin/delete")
    void removeShortLink(@RequestBody RecycleBinRemoveReqDto requestParam);

    @GetMapping("/api/shortLink/v1/stats")
    Result<ShortLinkStatsRespDTO> oneShortLinkStats(@RequestParam("fullShortUrl") String fullShortUrl,@RequestParam("gid") String gid,@RequestParam("startDate") String startDate,@RequestParam("endDate") String endDate);

    @GetMapping("/api/shortLink/v1/stats/access-record")
    Result<Page<ShortLinkStatsAccessRecordRespDTO>> shortLinkStatsRecordAccess(@RequestParam("fullShortUrl") String fullShortUrl,@RequestParam("gid") String gid,@RequestParam("startDate") String startDate,@RequestParam("endDate") String endDate);


    @GetMapping("/api/shortLink/v1/stats/group")
    Result<ShortLinkStatsRespDTO> groupShortLinkStats(@RequestParam("gid") String gid,@RequestParam("startDate") String startDate,@RequestParam("endDate") String endDate,@RequestParam("fullShortUrl") String fullShortUrl);


    @GetMapping("/api/shortLink/v1/stats/accessRecord/group")
    Result<Page<ShortLinkStatsAccessRecordRespDTO>> groupShortLinkStatsAccessRecord(@RequestParam("gid") String gid,@RequestParam("startDate") String startDate,@RequestParam("endDate") String endDate);
    /**
     * 批量创建短链接
     *
     * @param requestParam 批量创建短链接请求参数
     * @return 短链接批量创建响应
     */
    @PostMapping("/api/shortLink/v1/create/batch")
    Result<ShortLinkBatchCreateRespDTO> batchCreateShortLink(@RequestBody ShortLinkBatchCreateReqDTO requestParam);


}
